package com.zhong.learning.auto_paper.vo;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.our.learning.infrastructure.po.Paper;

import java.util.Date;
import java.util.List;

/**
 * @author zhong
 * @date 2023/6/29
 */
public class PaperVO {
    private Integer index;
    private Integer id;
    private String name;
    private Integer type;
    private Integer difficulty;
    private Integer sumScore;
    private Integer questionNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;
    private List<QuestionVO> questionList;

    public PaperVO() {
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(Integer difficulty) {
        this.difficulty = difficulty;
    }

    public Integer getSumScore() {
        return sumScore;
    }

    public void setSumScore(Integer sumScore) {
        this.sumScore = sumScore;
    }

    public Integer getQuestionNum() {
        return questionNum;
    }

    public void setQuestionNum(Integer questionNum) {
        this.questionNum = questionNum;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public List<QuestionVO> getQuestionList() {
        return questionList;
    }

    public void setQuestionList(List<QuestionVO> questionList) {
        this.questionList = questionList;
    }

    public PaperVO(Paper paper) {
        this.id = paper.getId();
        this.name = paper.getName();
        this.type = paper.getType();
        this.difficulty = paper.getDifficulty();
        this.sumScore = paper.getSumScore();
        this.questionNum = paper.getQuestionNum();
        this.createTime = paper.getCreateTime();
        this.questionList = JSON.parseArray(paper.getQuestions(), QuestionVO.class);
    }
}
